{extends file="../home.html"}
{block name="title"}{$head_title}{/block}
{block name="css"}
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/front/front_css/refresh_load.css?version={$version}"/>
	<style type="text/css">
		body{
			padding-top:2.2rem;
		}
		.home_news{
			background:#fff;
		}
		.home_news li.news-list{
		   	padding-top: .75rem;
    		border-top: .05rem solid #ddd;
    		border-top:0;
    		border-bottom:1px solid #ddd;
		}
		#load_wrapper{
			top:2.2rem;
		}
	</style>
{/block}
{block name="content"}
{include file="../common_header.html"}
	<div id="load_wrapper">
		<div id="scroller">
			<div id="pullDown">
			    <span class="pullDownIcon"></span>
			</div>
			<div class="park_box">
			    <div class="scroller_box clearfix">
			        <h6 class="fl" style="display:none;">切换分类</h6>
			        <div id="wrapper_list" class="fl" style="display:block;">
			            <div id="scroller_list">
			                <ul class="clearfix mall_list_tab">
			                    <li class="fl sort_tab_active">
			                        <a href="javascript:;" class="article_sort_id" article_sort_id=0 >全部</a>
			                    </li>
			                    {foreach from=$information_type_list item=information_type}
									<!--{if $smarty.foreach.city.index <= 2}-->
										<li class="fl">
											<a href="javascript:;" article_sort_id={$information_type.article_sort_id} class="article_sort_id">{$information_type.article_sort_name}</a>
										</li>
									<!--{/if}-->
			                    {/foreach}
			                    <!--<li class="fl">-->
			                        <!--<a href="javascript:;">上海</a>-->
			                    <!--</li>-->
			                    <!--<li class="fl">-->
			                        <!--<a href="javascript:;">深圳</a>-->
			                    <!--</li>-->
			                    <!--<li class="fl">-->
			                        <!--<a href="javascript:;">杭州</a>-->
			                    <!--</li>-->
			                    <!--<li class="fl">-->
			                        <!--<a href="javascript:;">武汉</a>-->
			                    <!--</li>-->
			                    <!--<li class="fl">-->
			                        <!--<a href="javascript:;">南京</a>-->
			                    <!--</li>-->
			                    <!--<li class="fl">-->
			                        <!--<a href="javascript:;">苏州</a>-->
			                    <!--</li>-->
			                </ul>
			            </div>
			        </div>
			        <i class="fr icon icon_shaixuan_default3x"></i>
			        <ul class="city_list clearfix" style="display:none;">
			            {foreach from=$information_type_list item=information_type key=key}
			            <li class="fl" class="article_sort_id" article_sort_id={$information_type.article_sort_id}>{$information_type.article_sort_name}</li>
			            {/foreach}
			            <!--<li class="fl">杭州</li>
			            <li class="fl">上海</li>
			            <li class="fl">南京</li>
			            <li class="fl">广州</li>
			            <li class="fl">武汉</li>
			            <li class="fl">合肥</li>
			            <li class="fl">张家界</li>
			            <li class="fl">乌鲁木齐</li>
			            <li class="fl">郑州</li>
			            <li class="fl">无锡</li>
			            <li class="fl">东莞</li>-->
			        </ul>
			       <!-- <div class="city_list_bg" style="display:none;"></div>-->
			    </div>
				<ul class="home_news">
					{foreach from=$information_list item=information}
			        <li class="news-list">
			            <a href="/FrontInformation/information_detail/information_id/{$information.article_id}" class="clearfix">
			                <div class="cont_time fl">
			                    <p>{$information.title}</p>
			                    <span>{date('Y-m-d',$information.addtime)}</span>
			                </div>
			                <img src="{$information.path_img}" alt="" class="fr" />
			            </a>
			        </li>
					{/foreach}
			   </ul>
			</div>
			<div id="pullUp">
				<span class="pullUpIcon"></span><span class="pullUpLabel">上拉加载...</span>
			</div>
		</div>
	</div>
	<div class="city_list_bg" style="display:none;"></div>
{/block}
{block name="js"}
<script>
	$(".back-word").on("click",function()
	{
		history.go(-1);
		//window.location='/FrontIndex/home_index';
	});
	var total={$total};
	var firstRow={$firstRow};
	var article_sort_id;
</script>
{literal}
	<script type="text/javascript" src="__PUBLIC__/Js/front/iscroll.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Js/front/front_js/iscroll_tab.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Js/front/front_js/news_load.js"></script>
	<script type="text/javascript">
        window.onload = function(){
	       	 var a = 0;
	       	$(".mall_list_tab li").each(function(){
	            var w = $(this).width();
	            a += w;
	            var w2=$(".icon_shaixuan_default3x").width();
	            $("#scroller_list").width(a+w2+10);
        	});
       	}
            $(function()
            {
//              $(".service_header i,.service_header span").on("click",function()
//              {
//                  history.go(-1);
//                 // window.location='/FrontIndex/home_index';
//              });
				//点击加号的方法
				function cilckChange(obj){
					
					obj.toggleClass('icon_close_default3x').toggleClass('icon_shaixuan_default3x');
                    $("#wrapper_list").toggle();
                    $(".scroller_box>h6").toggle();
                    $(".city_list").toggle();
                   
//                  var h = $(window).height() - [$(".scroller_box").height() + $(".scroller_box").offset().top-$(document).scrollTop()];
					var t = $(".scroller_box").height() + $(".service_header").height() + $(".city_list").innerHeight();
					var h = $(window).height() - t + 2;
                    $(".city_list_bg").height(h);
                    $(".city_list_bg").toggle();
                    $("html,body").toggleClass("body_scroll");
				}
                $(".scroller_box i").on("click",function()
                {
                    cilckChange($(this));
                });
                $(".city_list li").on("click",function()
                {
                    $(this).addClass('active').siblings().removeClass('active');
                   	var articleSortId = $(this).attr("article_sort_id");
                  	var chooseCity = $(".mall_list_tab a[article_sort_id = "+articleSortId+"]");
                  	chooseCity.parent().addClass("sort_tab_active")
                  	.siblings().removeClass('sort_tab_active');
                  	
                  	//调用加号的方法
                  	cilckChange($(".scroller_box i"));
                  	//点击加号更多城市切换，调用ajax加载
					chooseTypeName(articleSortId);
                  	
                    var txt = $(this).html();
//                  console.log(txt);
                    $(".scroller_box p").show();
                    $(".scroller_box p").html(txt);
                    /*$(".city_list").toggle();
                    $(".scroller_box i").toggleClass('icon_close_default3x').toggleClass('icon_shaixuan_default3x');*/
                });

                var myScroll;
                //var i = $(".mall_list_tab");
               
               
                $(".mall_list_tab li").on("click",function(){
                    $(this).addClass("sort_tab_active").siblings().removeClass('sort_tab_active');
                });
                //滑动导航
                myScroll = new IScroll('#wrapper_list', { eventPassthrough: true, scrollX: true, scrollY: false, preventDefault: false });
            });
			
            $('.article_sort_id').click(function(){
            	var objId = $(this).attr('article_sort_id');
				article_sort_id=objId;
				chooseTypeName(objId);
            });
			//  切换标签加载部分
			function chooseTypeName(objId){
				article_sort_id=objId;
				//console.log(article_sort_id);
                $.ajax({
                    url:'/FrontInformation/filter_information',
                    type:"post",
                    dataType:"json",
                    data:{'article_sort_id':article_sort_id},
                    success:function(data){
                        console.log(data);
                        if(data.code==1) {
							total = data.total;
							num = 1;
							if (data.data!=null) {
								if (total <= firstRow) {
									$(".pullUpIcon").hide();
									$(".pullUpLabel").html("没有更多了");
								}
								var len = data.data.length;
								var i = 0;
								var html = '';
								for (i = 0; i < len; i++) {
									html += '<li class="news-list">' +
											'<a href="/FrontInformation/information_detail/information_id/' + data.data[i].article_id + '" class="clearfix">' +
											'<div class="cont_time fl">' +
											'<p>' + data.data[i].title + '</p>' +
											'<span>' + data.data[i].time + '</span>' +
											'</div>' +
											'<img src="' + data.data[i].path_img + '" alt="" class="fr" />' +
											'</a>' +
											'</li>'
								}
								$('.home_news').html(html);
								setTimeout(function () {
									myScroll.refresh();
								}, 500);
							} else {
								$('.home_news').html('');
								$(".pullUpIcon").hide();
								$(".pullUpLabel").html("没有更多了");
							}
						}
                    }
                });
			}
			
        </script>

{/literal}
{/block}